//
//  DENSummarizeTableViewCell.m
//  Icar
//
//  Created by apple on 15/10/20.
//  Copyright © 2015年 小龙侠. All rights reserved.
//

#import "DENSummarizeTableViewCell.h"

@implementation DENSummarizeTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creatControl];
    }
    return self;
}
- (void)creatControl
{
// 创建标题
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(15), HEIGHT(8), WIDTH(250), HEIGHT(20))];
    self.titleLabel.font = [UIFont systemFontOfSize:20];
    [self.contentView addSubview:self.titleLabel];
//    配置
    self.config = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(15), HEIGHT(43), WIDTH(330), HEIGHT(15))];
    self.config.textColor = [UIColor grayColor];
    [self.contentView addSubview:self.config];
//    最低价格
    self.minPrice = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(15), HEIGHT(73), WIDTH(120), HEIGHT(15))];
    self.minPrice.textColor = [UIColor redColor];
    [self.contentView addSubview:self.minPrice];
    
//    官方价格
    self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(WIDTH(150), HEIGHT(73), WIDTH(120), HEIGHT(15))];
    self.priceLabel.textColor = [UIColor blackColor];
    [self.contentView addSubview:self.priceLabel];
    
}
- (void)setFindModel:(DENFindModel *)findModel
{
    
    self.titleLabel.text = findModel.title;
    self.config.text = findModel.config;
    self.minPrice.text = [NSString stringWithFormat:@"¥%@万起",findModel.minPrice];

    //   价格上的横线
    NSString *Str = [NSString stringWithFormat:@"¥%@万",findModel.price];
    NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:Str];
    [attri addAttribute:NSStrikethroughStyleAttributeName value:@(NSUnderlinePatternSolid | NSUnderlineStyleSingle) range:NSMakeRange(0, [attri length])];
    [attri addAttribute:NSStrikethroughColorAttributeName value:[UIColor grayColor] range:NSMakeRange(0, [attri length])];
    [self.priceLabel setAttributedText:attri];
    

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
